<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <title>时间计算器</title>

		<style>
			 .input-in{
				width:6em;
				height:1.6em;
			 }

		</style>
        <script type="text/javascript">
//↓第一个时间点
		function calc1() {
			var H1 = document.getElementById("H1"); 
			var H2 = document.getElementById("H2"); 
			var H3 = document.getElementById("H3"); 
			var H4 = document.getElementById("H4"); 
			var H5 = document.getElementById("H5"); 
			var H6 = document.getElementById("H6"); 
			var H7 = document.getElementById("H7"); 
			var H8 = document.getElementById("H8"); 
			var M1 = document.getElementById("M1"); 
			var M2 = document.getElementById("M2");
			var M3 = document.getElementById("M3"); 
			var M4 = document.getElementById("M4"); 
			var M5 = document.getElementById("M5"); 
			var M6 = document.getElementById("M6"); 
			var M7 = document.getElementById("M7"); 
			var M8 = document.getElementById("M8"); 
			var A1 = document.getElementById("A1"); 
			var A2 = document.getElementById("A2"); 
			var A3 = document.getElementById("A3"); 
			var A4 = document.getElementById("A4"); 
			var A5 = document.getElementById("A5"); 
			var A6 = document.getElementById("A6"); 
			var A7 = document.getElementById("A7"); 
			var A8 = document.getElementById("A8"); 
if(H1.value>=H2.value){
	if(H1.value>H2.value){
		if(M1.value<=M2.value)
		{
			A1.value=parseFloat(H1.value)-parseFloat(H2.value)+parseFloat(M1.value)/60-parseFloat(M2.value)/60; 
		
		}else{
			A1.value=parseFloat(H1.value)-parseFloat(H2.value)+parseFloat(M1.value)/60-parseFloat(M2.value)/60;
		}
	}else if (H1.value=H2.value){
		if(M1.value>M2.value){
			A1.value=parseFloat(M1.value)/60-parseFloat(M2.value)/60;
		}else{
			A1.value=eval(0);
		}
	}else{
		A1.value=eval(0);
	}
}else{
		A1.value=eval(0);
	}
}
//↓第二个时间点
function calc2() {
			var H1 = document.getElementById("H1"); 
			var H2 = document.getElementById("H2"); 
			var H3 = document.getElementById("H3"); 
			var H4 = document.getElementById("H4"); 
			var H5 = document.getElementById("H5"); 
			var H6 = document.getElementById("H6"); 
			var H7 = document.getElementById("H7"); 
			var H8 = document.getElementById("H8"); 
			var M1 = document.getElementById("M1"); 
			var M2 = document.getElementById("M2");
			var M3 = document.getElementById("M3"); 
			var M4 = document.getElementById("M4"); 
			var M5 = document.getElementById("M5"); 
			var M6 = document.getElementById("M6"); 
			var M7 = document.getElementById("M7"); 
			var M8 = document.getElementById("M8"); 
			var A1 = document.getElementById("A1"); 
			var A2 = document.getElementById("A2"); 
			var A3 = document.getElementById("A3"); 
			var A4 = document.getElementById("A4"); 
			var A5 = document.getElementById("A5"); 
			var A6 = document.getElementById("A6"); 
			var A7 = document.getElementById("A7"); 
			var A8 = document.getElementById("A8"); 
if(H3.value<=H4.value){
	if(H3.value<H4.value){
		if(M3.value<=M4.value){
			A2.value=parseFloat(H4.value)-parseFloat(H3.value)+parseFloat(M4.value)/60-parseFloat(M3.value)/60; 
		
		}else{
			A2.value=parseFloat(H4.value)-parseFloat(H3.value)+parseFloat(M4.value)/60-parseFloat(M3.value)/60;
		}
	}else if (H3.value=H4.value){
		if(M3.value<M4.value){
			A2.value=parseFloat(M4.value)/60-parseFloat(M3.value)/60;
		}else{
			A2.value=eval(0);
		}
	}else{
		A2.value=eval(0);
	}
}else{
		A2.value=eval(0);
	}
}
//↓第四个时间点
function calc4() {
			var H7 = document.getElementById("H7"); 
			var H8 = document.getElementById("H8"); 
			var M7 = document.getElementById("M7"); 
			var M8 = document.getElementById("M8"); 
			var A4 = document.getElementById("A4"); 
if(H7.value<=H8.value){
	if(H7.value<H8.value){
		if(M7.value<=M8.value)
		{
			A4.value=parseFloat(H8.value)-parseFloat(H7.value)+parseFloat(M8.value)/60-parseFloat(M7.value)/60; 
		
		}else{
			A4.value=parseFloat(H8.value)-parseFloat(H7.value)+parseFloat(M8.value)/60-parseFloat(M7.value)/60;
		}
	}else if (H7.value=H8.value){
		if(M7.value<M8.value){
			A4.value=parseFloat(M8.value)/60-parseFloat(M7.value)/60;
		}else{
			A4.value=eval(0);
		}
	}else{
		A4.value=eval(0);
	}
}else{
		A4.value=eval(0);
	}
}

//↓第三个时间点
function calc3() {
			var H5 = document.getElementById("H5"); 
			var H6 = document.getElementById("H6"); 
			var M5 = document.getElementById("M5"); 
			var M6 = document.getElementById("M6");  
			var A3 = document.getElementById("A3"); 
if(H5.value>=H6.value){
	if(H5.value>H6.value){
		if(M5.value<=M6.value){
			A3.value=parseFloat(H5.value)-parseFloat(H6.value)+parseFloat(M5.value)/60-parseFloat(M6.value)/60; 
		
		}else{
			A3.value=parseFloat(H5.value)-parseFloat(H6.value)+parseFloat(M5.value)/60-parseFloat(M6.value)/60;
		}
	}else if (H5.value=H6.value){
		if(M5.value>M6.value){
			A3.value=parseFloat(M5.value)/60-parseFloat(M6.value)/60;
		}else{
			A3.value=eval(0);
		}
	}else{
		A3.value=eval(0);
	}
}else{
		A3.value=eval(0);
	}
}




function calc5(){
			var H1 = document.getElementById("H1"); 
			var H2 = document.getElementById("H2"); 
			var H3 = document.getElementById("H3"); 
			var H4 = document.getElementById("H4"); 
			var H5 = document.getElementById("H5"); 
			var H6 = document.getElementById("H6"); 
			var H7 = document.getElementById("H7"); 
			var H8 = document.getElementById("H8"); 
			var M1 = document.getElementById("M1"); 
			var M2 = document.getElementById("M2");
			var M3 = document.getElementById("M3"); 
			var M4 = document.getElementById("M4"); 
			var M5 = document.getElementById("M5"); 
			var M6 = document.getElementById("M6"); 
			var M7 = document.getElementById("M7"); 
			var M8 = document.getElementById("M8"); 
			var A1 = document.getElementById("A1"); 
			var A2 = document.getElementById("A2"); 
			var A3 = document.getElementById("A3"); 
			var A4 = document.getElementById("A4"); 
			var A5 = document.getElementById("A5"); 
			var A6 = document.getElementById("A6"); 
			var A7 = document.getElementById("A7"); 
			var A8 = document.getElementById("A8"); 
	//A5为每日错时时间
	A5.value=parseFloat(A1.value)+parseFloat(A2.value)+parseFloat(A3.value)+parseFloat(A4.value);
	//A6为每日开放时间
	A6.value=parseFloat(H4.value)-parseFloat(H2.value)+parseFloat(M4.value)/60-parseFloat(M2.value)/60+parseFloat(H8.value)-parseFloat(H6.value)+parseFloat(M8.value)/60-parseFloat(M6.value)/60;
	//开放时间为周一至周日
	zhoukai.value=A6.value*7;
	cuoshi.value=A5.value*5+A6.value*2;
	//开放时间为周一至周五
	zhoukai1.value=A6.value*5;
	cuoshi1.value=A5.value*5;
	//开放时间仅为单天
	zhoukai2.value=A6.value;
	cuoshi2.value=A5.value;
	}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
</script>     

    </head>
    <body>
<div id="" class="">
	
	<table>
		<tr>
			<td>标准:</td>
			<td><input class="input-in" type="text" id="H1" /></td>
			<td><input class="input-in" type="text" id="M1" value="0"/>&nbsp-</td>
			<td><input class="input-in" type="text" id="H3" /></td>
			<td><input class="input-in" type="text" id="M3" value="0"/>&nbsp&nbsp&nbsp</td>
			<td><input class="input-in" type="text" id="H5" /></td>
			<td><input class="input-in" type="text" id="M5" value="0"/>&nbsp-</td>
			<td><input class="input-in" type="text" id="H7" /></td>
			<td><input class="input-in" type="text" id="M7" value="0"/></td>
		</tr>
		<tr>
			<td>实际:</td>
			<td><input class="input-in" type="text" id="H2" /></td>
			<td><input class="input-in" type="text" id="M2" value="0"/>&nbsp-</td>
			<td><input class="input-in" type="text" id="H4" /></td>
			<td><input class="input-in" type="text" id="M4" value="0"/>&nbsp&nbsp&nbsp</td>
			<td><input class="input-in" type="text" id="H6" /></td>
			<td><input class="input-in" type="text" id="M6" value="0"/>&nbsp-</td>
			<td><input class="input-in" type="text" id="H8" /></td>
			<td><input class="input-in" type="text" id="M8" value="0"/></td>
		</tr>
	</table>
	<br>
	<div class="juzhong">
		<input style="width:300px" id="opTips" type="button" value="计算结果" onclick="calc1();calc2();calc3();calc4();calc5();"/>
	</div>
	<br>
	<span class="">
		开放时间：周一至周<font size="" color="#ff0000">日</font>→
		周开：<input type='text' id='zhoukai' style="border:0px solid white; width:35px" />
		错时：<input type='text' id='cuoshi' style="border:0px solid white; width:35px" /></span>
	<br><br>
	<span class="">
		开放时间：周一至周<font size="" color="#ff0000">五</font>→
		周开：<input type='text' id='zhoukai1' style="border:0px solid white; width:35px" />
		错时：<input type='text' id='cuoshi1' style="border:0px solid white; width:35px" /></span>
	<br><br>
	<span class="">
		开放时间：单日→
		开放：<input type='text' id='zhoukai2' style="border:0px solid white; width:35px" />
		错时：<input type='text' id='cuoshi2' style="border:0px solid white; width:35px" /></span>

	<div id="" class="" style="">
		<input class="input-in" type="text" id="A1"  />&nbsp
		<input class="input-in" type="text" id="A2"  />&nbsp
		<input class="input-in" type="text" id="A3" />&nbsp
		<input class="input-in" type="text" id="A4" />&nbsp
		<input class="input-in" type="text" id="A5" />&nbsp
		<input class="input-in" type="text" id="A6" />&nbsp
		<input class="input-in" type="text" id="A7" />&nbsp
		<input class="input-in" type="text" id="A8" />&nbsp
	</div>
</div>
</body>
 
</html>